/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.team1160.breakaway.ballControl;

import com.team1160.breakaway.api.Constants;
import com.team1160.breakaway.pneumatics.Piston;
import com.team1160.breakaway.pneumatics.Pneumatics;
import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.Servo;
import edu.wpi.first.wpilibj.Timer;

/**
 *
 * @author Team 1160 Firebird Robotics 
 */
public class Kicker {
    //private static fields
    ////////////////////////////////////////////////////////////////////////////
    protected AnalogChannel pot;

    protected final Pneumatics PNEUMATICS = new Pneumatics();
    protected final Piston PISTON = PNEUMATICS.getPiston();

    protected final Servo SERVO = new Servo(Constants.C_SERVO);

    //constructor
    ////////////////////////////////////////////////////////////////////////////
    public Kicker () {
        pot = new AnalogChannel(Constants.C_POTENTIOMETER);
    }

    //methods
    ////////////////////////////////////////////////////////////////////////////
    /**
     * This method fires and retracts the Kicker
     */
    public void shoot(){
        this.fire();
        Timer.delay(0.25);
        this.retract();
    }
    
    /**
     * Fires the kicker
     */
    public void fire(){
        PISTON.fire();
        SERVO.set(Constants.A_SERVO_TURN);
    }

    /**
     * Retracts the kicker.
     */
    public void retract(){
        PISTON.retract();
        SERVO.set(-1*Constants.A_SERVO_TURN);
    }
}
